﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using DATA.BusinessObjects;

namespace Presentation
{
    public partial class frmManHinhChinh : Form
    {
        private bool icon = false;
        public frmManHinhChinh()
        {
            InitializeComponent();
            this.notifyIcon.Icon = Properties.Resources.Green;
        }

        private void Menu_ToChuc_ThayDoiQuiDinh1_Click(object sender, EventArgs e)
        {
            frmCapNhatDonGiaLoaiPhong frm = new frmCapNhatDonGiaLoaiPhong();
            frm.MdiParent = this;
            frm.Show();
        }

        private void Menu_ToChuc_ThayDoiQuiDinh2_Click(object sender, EventArgs e)
        {
            frmThayDoiHeSoLoaiKhach frm = new frmThayDoiHeSoLoaiKhach();
            frm.MdiParent = this;
            frm.Show();
        }

        private void Menu_ThongKe_BaoCaoDoanhThuTheoLoaiPhong_Click(object sender, EventArgs e)
        {
            frmBaoCaoDoanhThuTheoLoaiPhong frm = new frmBaoCaoDoanhThuTheoLoaiPhong();
            frm.MdiParent = this;
            frm.Show();
        }

        private void Menu_ThongKe_BaoCaoMatDoSuDungPhong_Click(object sender, EventArgs e)
        {
            frmBaoCaoTheoMatDoSuDungPhong frm = new frmBaoCaoTheoMatDoSuDungPhong();
            frm.MdiParent = this;
            frm.Show();
        }

        private void Menu_QuanLyThue_TraPhong_LapHoaDonThanhToan_Click(object sender, EventArgs e)
        {
            frmLapHoaDonThanhToan frm = new frmLapHoaDonThanhToan();
            frm.MdiParent = this;
            frm.Show();
        }

        private void Menu_QuanLyThue_TraPhong_LapPhieuThuePhong_Click(object sender, EventArgs e)
        {
            frmLapPhieuThuePhong frm = new frmLapPhieuThuePhong();
            frm.MdiParent = this;
            frm.Show();
        }

        private void Menu_QuanLyPhong_TraCuuPhong_Click(object sender, EventArgs e)
        {
            frmTraCuuPhong frm = new frmTraCuuPhong();
            frm.MdiParent = this;
            frm.Show();
        }

        private void Menu_QuanLyPhong_TiepNhanPhong_Click(object sender, EventArgs e)
        {
            frmTiepNhanPhong frm = new frmTiepNhanPhong();
            frm.MdiParent = this;
            frm.Show();
        }

        private void frmManHinhChinh_Load(object sender, EventArgs e)
        {
            IrisSkin.ApplyAdditionalBuiltInSkins(0);
            IList<Phong> lstPhong = PhongBUS.LayDanhSachPhong();    // Load danh sách lên lần đầu để cho form chạy nhanh cho các lần sau.
        }

        private void Menu_ToChuc_ThayDoiTiLePhuThu_Click(object sender, EventArgs e)
        {
            frmThayDoiTiLePhuThu frm = new frmThayDoiTiLePhuThu();
            frm.MdiParent = this;
            frm.Show();
        }

        private void Menu_ToChuc_Thoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void Menu_QuanLyKhachHang_TiepNhanKhachHang_Click(object sender, EventArgs e)
        {
            frmTiepNhanKhachHang frm = new frmTiepNhanKhachHang();
            frm.MdiParent = this;
            frm.Show();
        }

        private void Menu_QuanLyKhachHang_TraCuuKhachHang_Click(object sender, EventArgs e)
        {
            frmTraCuuKhachHang frm = new frmTraCuuKhachHang();
            frm.MdiParent = this;
            frm.Show();
        }

        private void Menu_ThongKe_CrystalReport_Click(object sender, EventArgs e)
        {
            frmBaoCaoSuDungCrystalReport frm = new frmBaoCaoSuDungCrystalReport();
            frm.MdiParent = this;
            frm.Show();
        }

        private void notifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
        {

        }

        private void notifyIcon_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (icon == false)
                {
                    icon = true;
                    //this.notifyIcon.Icon = Properties.Resources.Yellow;
                    this.notifyIcon.Icon = Properties.Resources.Green;
                }
                else
                {
                    icon = false;
                    //this.notifyIcon.Icon = Properties.Resources.Green;
                    this.notifyIcon.Icon = Properties.Resources.Yellow;
                }
            }
        }

        private void notifyIcon_BalloonTipClosed(object sender, EventArgs e)
        {
            this.Close();
        }

        private void helpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            HelpProvider hPro = new System.Windows.Forms.HelpProvider();
            //hPro.SetShowHelp(helpToolStripMenuItem_Click, true);
            hPro.HelpNamespace = "Help.chm";
            Help.ShowHelp(this, hPro.HelpNamespace);
        }

        private void frmManHinhChinh_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F1)
            {
                Help.ShowHelp(this, "Help.chm");
            }
        }

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            HelpProvider hPro = new System.Windows.Forms.HelpProvider();
            hPro.HelpNamespace = "Readme.txt";
            Help.ShowHelp(this, hPro.HelpNamespace);
        }
    }
}
